package cn.lcsjsxy.yxz.inheritance.practice2;

//  圆柱
public class Cylinder extends Circle {

    //

    private double length;

    public Cylinder() {

        length = 1.0;
    }

    /*public Circle(double radius){
        this.radius() = radius;
    }*/

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    //体积
    public double findVolume() {
        return Math.PI * getRadius() * getRadius() * getLength();
        //或
        //return findArea() * getLength();
    }

    public double ffindVolume() {
//        return Math.PI * getRadius() * getRadius() * getLength();
        return super.findArea() * getLength();
    }

    public double findArea() {    //返回表面积
        return Math.PI * getRadius() * getRadius() * 2 + 2 * Math.PI * getRadius() * getLength();
    }
}
